package com.net.xpay.core.service.safePay;

import com.net.xpay.common.domain.BookAccountTransferOrder;
import com.net.xpay.common.domain.User;
import com.net.xpay.core.domain.safePay.BookAccountChargeOrder;
import com.net.xpay.core.domain.safePay.SafePayBatch;
import com.net.xpay.core.enums.SafePayOrderStatus;
import com.net.xpay.core.model.*;
import com.net.xpay.core.model.*;

import java.util.concurrent.ExecutionException;

public interface SafePayService {

    /**
     * 资金账本充值
     */
    BookAccountChargeOrder createBookAccountChargeOrder(User user, BookAccountChargeOrderModel model);

    /**
     * 同名银行卡入金记账本充值
     */
    BookAccountChargeOrder notifyCreateBookAccountChargeOrder(BookAccountChargeOrderNotifyModel bookAccountChargeOrderNotifyModel);


    /**
     * 资金账本充值结果查询
     */
    void updateBookAccountChargeOrder(Long id);

    /**
     * 创建付款批次
     */
    SafePayBatch createSafePayBatch(User user, SafePayBatchCreateModel model);

    /**
     * 开始触发转账
     */
    SafePayBatch transSafePayBatch(User user, SafePayBatchTransModel model);

    /**
     * 后台处理转账
     */
    void processTransSafePayBatch(Long safePayBatchId) throws ExecutionException, InterruptedException;

    /**
     * 跟新处理中的银行转账批次
     */
    void updateDealingBankBatch(Long safePayBatchId);

    /**
     * 跟新处理中的订单
     */
    void updateDealingSafePayOrder(Long safePayOrderId);

    void sendCheckCode(User user, Long batchId, String ip, Integer useSpareReceiveMobile);

    void closeSafePayBatch(User user, String importBatchNo);

    void closeSafePayBatchById(User user, Long id);

    /**
     * 跟新安全付单笔订单
     */
    void updateSafePayOrder(Long id, SafePayOrderStatus status, String errorMsg, String errorCode);

    /**
     * 安全付手动输入打款名单
     */
    SafePayBatch manualImportSafePayTrans(User user, ManualSafePayTransModel transModel);

    /**
     * 跟新签约信息
     *
     * @param outBizNo      外部协议号
     * @param agreementNo   协议号
     * @param extCardInfo   卡号信息
     * @param accountBookId 账本id
     */
    void updateSafePayAccount(String outBizNo, String agreementNo, String extCardInfo, String accountBookId);


    /**
     * 获取签约链接 根据用户的开关自动选择签约方式
     */
    String getSignPage(User user, SafePayPageSignModel signModel);

    /**
     * 获取签约链接 新方式
     */
    String getSignPage2(User user, SafePayPageSignModel signModel);

    /**
     * 记账本之间调拨
     */
    BookAccountTransferOrder transferBookAccount(User user, BookAccountTransferOrderModel model);

    /**
     * 资金调拨成功通知
     */
    void notifyTransferBookAccountSuccess(String outBizNo, String payFundOrderId, String orderId);
}
